package com.itheima.d7_interface_demo.interface_demo2;

import java.util.ArrayList;

public class StudentServiceimpl1 implements StudentService {


    @Override
    public void printAllInfo(ArrayList<Student> students) {//打印所有信息

        for (Student student : students) {
            System.out.println("姓名：" + student.getName() + " 性别：" + student.getSex() + " 成绩：" + student.getScore());
        }
    }

    @Override
    public void printAverageScore(ArrayList<Student> students) {//打印平均分
        int sum = 0;
        for (Student student : students) {
            sum += student.getScore();
        }
        System.out.println("平均分是"+sum/students.size());
    }
}
